package com.ymatou.iapi.productmanager.service.old;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;

import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.JsonBeanHelper;
import com.ymttest.utils.MapUtil;
import com.ymttest.utils.compare.CallAPI;

public class GetSellerProductListCall extends YmatouAutoTestCall implements CallAPI{
	private static String opurl ="api/SellerProduct/GetSellerProductList";

	public GetSellerProductListCall() {
		super(EnvSetup.getSystemUrl("productmanager"),opurl,"POST","JSON");
	}
	public GetSellerProductListCall(String systemUrl) {
		super(systemUrl,opurl,"POST","JSON");
	}
	
	public JSONObject SearchBySellerIdAndProdList(int sellerId, List<String> prodList){
		JSONObject requestBean = this.getJsonBean(null);
		
		JsonBeanHelper.updateJsonBean(requestBean, MapUtil.hashMap("ProductIdList", new JSONArray(prodList),"SellerId",sellerId));
		
		return callAndGetReturnData(requestBean);
	}
	
	
	public void addDefHeader() {
		client.addHeader("Content-Type", "application/json");
	}
	
	
	public static void main(String[] args) {
		GetSellerProductListCall aCall = new GetSellerProductListCall();
		aCall.SearchBySellerIdAndProdList(20336378, Arrays.asList("ffccfb53-b0bd-4104-8ebb-498d708adfe9"));
	}


	@Override
	public JSONObject callAndReturn(Map<String, Object> paramMap) {
		return this.callAndGetReturnData(paramMap);
	}


	@Override
	public String getApiName() {
		return "GetSellerProductList";
	}
}
